using System;
using System.Windows.Forms;

namespace GaleSong
{
    internal class KeyMsgFilter : IMessageFilter
    {
        #region Delegates

        public delegate bool KeyPressFunc(int vk);

        #endregion

        #region IMessageFilter Members

        public bool PreFilterMessage(ref Message m)
        {
            int wParam = m.WParam.ToInt32();
            if (m.Msg == 0x0100) //WM_KEYDOWN
            {
                if (OnKeyPress != null)
                    return OnKeyPress(wParam);
            }
            return false;
        }

        #endregion

        public static event KeyPressFunc OnKeyPress;
    }

    public static class Program
    {
        /// <summary>
        ///     The main entry point for the application.
        /// </summary>
        [STAThread]
        private static void Main()
        {
            var application = new GaleSongApplication();
            application.Run();
        }
    }
}